package com.lvwenguo.controller.purchaselist;

import com.lvwenguo.service.PurchaseServiceInter;
import com.lvwenguo.service.serviceImple.PurchaseServiceImple;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//模糊查询进货记录
@WebServlet(urlPatterns = "/selectPurchase")
public class selectPurchase extends HttpServlet {
    PurchaseServiceInter purchaseServiceImpol =new PurchaseServiceImple();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String product_name = req.getParameter("product_name");
        req.setAttribute("Category", purchaseServiceImpol.selectMohu("%" + product_name + "%"));
        req.getRequestDispatcher("/view/purchase/purchase_list.jsp").forward(req,resp);

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req,resp);
    }
}
